$(function () {
	//部署公告
    $.ajax({
    	async: true,
        url: OA_SERVER_NAME+"cxf/noc/getnotice/getgg",
        type:'get',
        dataType: 'json',
        contentType: 'application/json',
        data: {
             //"fbrempName":"",//发布人姓名
            "header":"",    //公告标题
            "pageSize":"3",//每页3条
            "pageNum":"1",//默认首页
            
            "startdate":"",
            "enddate":"",
            
            "category":"2",
            "empid": '',                         //工号id
            "ggid":''                        //公告id
            
        },
        success: function (data) {
        	if(data.reponseParam==null || data.reponseParam==undefined ||data.reponseParam=='') {
        		return;
        	}
            for (var i = 0; i <data.reponseParam.length; i++) {
                var str = '<tr>'+
            	 '<td>'+
            	 '<a class="notice-item-title" target="view_window"  href="noticedetail.html?ggid='
            	 + data.reponseParam[i].id 
            	 +'">'
                 + data.reponseParam[i].docsubject 
            	 +'</a>'
            	 
            	 +'<span class ="notice-item-date">'             
                    + data.reponseParam[i].docvaliddate
                    +'&nbsp'+'&nbsp'
                    +data.reponseParam[i].docvalidtime
                    + '</span></td></tr>';
                   
                $("#deployNoticeBody").append(str);
            }
        },
        err:function(XMLHttpRequest, textStatus, errorThrown){
        	
        }
    });

    //营销公告
    $.ajax({
        async: true,
        url: OA_SERVER_NAME+"cxf/noc/getnotice/getgg",
        type:'get',
        dataType: 'json',
        contentType: 'application/json',
        data: {
        	  "header":"",    //公告标题
              "pageSize":"3",//每页3条
              "pageNum":"1",//默认首页
              
              "startdate":"",
              "enddate":"",
              
              "category":"1",
              "empid": '',                         //工号id
              "ggid":''                        //公告id
        },
        success: function (data) {
        	if(data.reponseParam==null || data.reponseParam==undefined ||data.reponseParam=='') {
        		return;
        	}
            for (var i = 0; i <data.reponseParam.length; i++) {
		        	var str = '<tr>'+
		           	 '<td>'+
		           	 '<a class="notice-item-title" target="view_window"  href="noticedetail.html?ggid='
		           	 + data.reponseParam[i].id 
		           	 +'">'
		                + data.reponseParam[i].docsubject 
		           	 +'</a>'
		           	 
		           	 +'<span class ="notice-item-date">'             
		                   + data.reponseParam[i].docvaliddate
		                   +'&nbsp'+'&nbsp'
		                   +data.reponseParam[i].docvalidtime
		                   + '</span></td></tr>';
		        	$("#marketingNoticeBody").append(str);
            }
        }
    });

    /*控制文字显示长度*/
    function controlLength(str, len) {
        if (str.length > len) {
            return str.substr(0, len - 1) + "....";
        } else {
            return str;
        }
    }
    $('.notice_link').append('<a href="noticeList.html?category=2&catype=2" target="_blank">查看全部></a>');
});


function noticeClickLi(liindex) {
    var a1_link='<a href="noticeList.html?category=1&catype=1" target="_blank">查看全部></a>'
    var a2_link='<a href="noticeList.html?category=2&catype=2" target="_blank">查看全部></a>'
    $('.notice_link').append(a2_link);
    $('.notice_link').html('')
    if(liindex == 2){
        $('.notice_link').append(a2_link);
    }else{
        $('.notice_link').append(a1_link);
    }
};